<?php
/**
 * Created by PhpStorm.
 * User: root
 * Date: 2018/5/30
 * Time: 9:43
 */

namespace Pay\Controller;
use Think\Controller;

class QrcodeController extends Controller {

    public function getCode(){
        import("Vendor.phpqrcode.phpqrcode",'',".php");

        $type = I("get.type",0,"intval");

        switch ($type){
            case 2:
                $url = base64_decode($_GET["data"]);
                break;
            case 1:
                $url = $_GET["data"];
                break;
            default:
                $url = urldecode($_GET["data"]);
        }
        \QRcode::png($url,false,"L",5);
    }
}